Skip to content

feat: add deepcopy implementation for BoundedAttributes#4934

Merged
lzchen merged 7 commits intoopen-telemetry:mainfrom
herin049:feat/bounded-attr-deepcopy
Mar 13, 2026
Merged

feat: add deepcopy implementation for BoundedAttributes#4934
lzchen merged 7 commits intoopen-telemetry:mainfrom
herin049:feat/bounded-attr-deepcopy

Conversation

@herin049
Copy link
Contributor

Description

Adds a custom __deepcopy__ implementation for BoundedAttributes.

Fixes #4928

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

tox -e py314-test-opentelemetry-sdk

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added

@herin049 herin049 requested a review from a team as a code owner February 24, 2026 23:16
Copy link
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like if you create a span via tracer.start_as_current_span(...), the _events member is set to a BoundedList, which apparently also has a lock that will prevent a deep copy.

@tammy-baylis-swi tammy-baylis-swi moved this to Reviewed PRs that need fixes in Python PR digest Feb 25, 2026
@herin049 herin049 force-pushed the feat/bounded-attr-deepcopy branch from 012a9c0 to 8d5e9a7 Compare March 8, 2026 22:02
@herin049 herin049 requested a review from pmcollins March 9, 2026 00:00
@herin049 herin049 force-pushed the feat/bounded-attr-deepcopy branch 2 times, most recently from 820251f to 9c918df Compare March 10, 2026 18:59
Copy link
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the change.

@herin049 herin049 force-pushed the feat/bounded-attr-deepcopy branch 2 times, most recently from c656d4b to 976b17a Compare March 13, 2026 01:40
@herin049 herin049 moved this from Reviewed PRs that need fixes to Approved PRs in Python PR digest Mar 13, 2026
@herin049 herin049 force-pushed the feat/bounded-attr-deepcopy branch from 976b17a to 1ca84f7 Compare March 13, 2026 17:41
@lzchen lzchen merged commit 5fe8092 into open-telemetry:main Mar 13, 2026
461 checks passed
@github-project-automation github-project-automation bot moved this from Approved PRs to Done in Python PR digest Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add __deepcopy__ support to Span and BoundedAttributes

3 participants